package mr;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;

public class Test3 {
    public static void main(String[] args)throws Exception {

        BufferedReader br = new BufferedReader
                (new FileReader("F:\\数加\\代码\\nanshan\\date\\students.txt"));

        int index=0;

        BufferedWriter bw = new BufferedWriter
                (new FileWriter("F:\\数加\\代码\\nanshan\\split01\\split---" + index));


        ArrayList<String> list = new ArrayList<>();

        String line;
        int flag=0;


        while ((line= br.readLine())!=null){

            list.add(line);
            flag++;

            if (flag==140){

                for (int i = index*128; i < (index+1)*128; i++) {

                    bw.write(list.get(i));
                    bw.newLine();
                }
                bw.flush();
                bw.close();
                index++;
                flag=12;
                bw=new BufferedWriter
                        (new FileWriter("F:\\数加\\代码\\nanshan\\split01\\split---" + index));

            }

        }

        for (int i = list.size()-flag; i < list.size(); i++) {
            bw.write(list.get(i));
            bw.newLine();
        }
        bw.close();
        br.close();


    }
}
